from sqlalchemy import  create_engine
import pandas as pd
engine = create_engine("mysql+pymysql://admin:Root123456!@192.168.18.76:3306/hrdata?charset=utf8")
print(engine)
#formlist = pd.read_sql_query("show tables",con=engine)
#print("hrdata数据库表清单为: \n",formlist)
formlist = pd.read_sql_query("show tables", con=engine)
print('hrdata数据库表清单为： \n',formlist)

occupations = pd.read_sql_table("occupations", con=engine)
print("读取的岗位详情表：\n",occupations)

occupations.to_sql("test",con=engine,index=False, if_exists="replace")
formlist1 = pd.read_sql_query("show tables", con=engine)
print("新增一个表格后hrdata数据库表单为:\n",formlist1)
